package com.mb.app.appused.fragment;

import com.mb.app.appused.R;
import com.mb.app.appused.base.BaseFragment;
import com.mb.app.appused.views.CustomViewPageTitle;
import com.mb.app.appused.views.CustomViewPageTitle.IconPoint;
import com.mb.app.appused.views.CustomViewPageTitle.SelectListener;
import com.mb.app.appused.views.CustomViewPager;

public class MainFragment extends BaseFragment {
	CustomViewPager viewPage;
	CustomViewPageTitle pageTitle;
	EmptyFragment  page2;
	TabOne page1;

	@Override
	public int getViewLayout() {
		// TODO Auto-generated method stub
		return R.layout.fragment_main;
	}

	@Override
	public void initView() {
		// TODO Auto-generated method stub
		viewPage = (CustomViewPager) getObject(R.id.main_page);
		pageTitle = (CustomViewPageTitle) getObject(R.id.main_title);
		pageTitle.setTitleBackground(0x00000000);
		pageTitle.setRectBackground(0x00000000);
		pageTitle.setRectColor(0xffcccccc);
		pageTitle.setTitleNomalColor(0xfff7f7f7);
		pageTitle.setTitleSelectColor(0xffffffff);
		pageTitle.setRectHeight(5);
		pageTitle.iconPoint = IconPoint.dowm;
		
		pageTitle.marginTop = 0;
		pageTitle.marginBottom = 15;

		pageTitle.setTitleSelect(14);
		pageTitle.setTitleNomal(14);

		page1 = new TabOne();
		page2 = new EmptyFragment();

		viewPage.addPage("", R.drawable.ic_main_list_nomal, R.drawable.ic_main_list_active, page1, getFragmentManager());
		viewPage.addPage("", R.drawable.ic_main_tab2_nomal, R.drawable.ic_main_tab2_active, page2, getFragmentManager());

		viewPage.setTitleView(pageTitle);
		viewPage.notifyDataSetChanged();

		pageTitle.setSelectListner(new SelectListener() {

			@Override
			public void onSelected(int select) {
				// TODO Auto-generated method stub
				viewPage.setCurrentItem(select);
			}
		});
	}

}
